package com.homework4.demo3;


//  “Learn java from Sun Xin's book”，翻转后为：“nraeL avaj morf nuSs'niX koob”。
public class test {
    public static String reverse(String str){
        String reverseStr="";
        String[] newString = str.split(" ");
        for (int i=0;i<newString.length;i++){
            StringBuilder sb = new StringBuilder(newString[i]);
            reverseStr += sb.reverse().toString()+" ";

        }
        return reverseStr;
    }
    public static void main(String[] args) {
        String str = "Learn java from Sun Xin's book";
        System.out.println(reverse(str));
    }
}